﻿using OrderApi.DTOs;
using OrderApi.Models;
using OrderApi.Repositories;

namespace OrderApi.Services
{
    public interface IOrderService
    {
        Task<Order> GetOrderByIdAsync(int id);
        Task<PagedResult<Order>> GetPagedOrdersAsync(int pageNumber, int pageSize);

        /// <summary>
        /// 获取已删除的订单列表
        /// </summary>
        /// <param name="pageNumber">页码</param>
        /// <param name="pageSize">每页数量</param>
        /// <returns>分页结果</returns>
        Task<PagedResult<Order>> GetDeletedOrdersAsync(int pageNumber = 1, int pageSize = 10);
        Task<Order> CreateOrderAsync(Order order);
        Task UpdateOrderAsync(Order order);
        Task DeleteOrderAsync(int id);
        Task<byte[]> ExportOrdersToExcelAsync();        

        /// <summary>
        /// 多条件查询订单（分页）
        /// </summary>
        /// <param name="parameters">查询参数</param>
        /// <returns>分页结果</returns>
        Task<PagedResult<Order>> QueryOrdersAsync(OrderQueryParameters parameters);
        /// <summary>
        /// 更新订单（部分更新）
        /// </summary>
        /// <param name="dto">更新数据</param>
        /// <returns>更新后的订单</returns>
        Task<Order> UpdateOrderAsync(UpdateOrderDto dto);
        /// <summary>
        /// 简化版订单更新（返回布尔值）
        /// </summary>
        /// <param name="dto">更新数据</param>
        /// <returns>更新是否成功</returns>
        Task<bool> SimpleUpdateOrderAsync(SimpleUpdateOrderDto dto);
        /// <summary>
        /// 假删除订单
        /// </summary>
        /// <param name="id">订单ID</param>
        /// <returns>操作是否成功</returns>
        Task<bool> SoftDeleteOrderAsync(int id);
    }
}
